﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace WindowsFormProject
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }
        int sayac = 0;
        private void button1_Click(object sender, EventArgs e)
        {
          
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("Application Closing...\nAre You Sure?","Caution",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes )
            {
                e.Cancel = false;
                Application.ExitThread();
            }
            else
            {
                e.Cancel = true;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            toolStripSaat.Text = DateTime.Now.ToLongTimeString();
            toolStripTarih.Text = DateTime.Now.ToLongDateString();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            timer2.Enabled = true;  
            
            
        }
        public void MesajYaz(string Mesaj)
        {
            toolStripMesaj.Text = Mesaj;
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            //if (sayac<=5)
            //{
            //    MesajYaz("mesaj");
            //}
            //else
            //{
            //    MesajYaz("");
            //    timer2.Enabled = false;
            //    sayac = 0;
            //}
            //sayac += 1;
            if (sayac > 5)
            {
               timer2.Enabled = false;
                sayac = 0;
                toolStripMesaj.Text = string.Empty;

            }
           
            sayac += 1;
        }

        private void tedarikcilerToolStripMenuItem_Click(object sender, EventArgs e)
        {

            Form frm = Application.OpenForms["FrmTedarikciler"] as Depo.FrmTedarikciler ;
            if (frm == null)
            {
                Form FrmTedarikciler = new Depo.FrmTedarikciler();
                FrmTedarikciler.MdiParent = ActiveForm;
                FrmTedarikciler.Show();
            }
            else
            {

                frm.Activate();
                //toolStripwindowStatuslbl.Visible = true;
                //toolStripwindowStatuslbl.Text = "Tedarikci tanıtım kartı yeniden aktif edildi!";
            }
        }

        private void alışlarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["FrmAlislar"] as Depo.FrmAlislar;
            if (frm == null)
            {
                Form FrmAlislar = new Depo.FrmAlislar();
                FrmAlislar.MdiParent = ActiveForm;
                FrmAlislar.Show();
            }
            else
            {

                frm.Activate();
                //toolStripwindowStatuslbl.Visible = true;
                //toolStripwindowStatuslbl.Text = "Tedarikci tanıtım kartı yeniden aktif edildi!";
            }
        }

        private void personelBilgileriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["Personelfrm"] as Personel.Personelfrm;
            if (frm == null)
            {

                Form Personelfrm = new Personel.Personelfrm();
                Personelfrm.MdiParent = ActiveForm;
                Personelfrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void personelGünlükTakipToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["PersonelGirisCikisFrm"] as Personel.PersonelGirisCikisFrm;
            if (frm == null)
            {

                Form PersonelGirisCikisFrm = new Personel.PersonelGirisCikisFrm();
                PersonelGirisCikisFrm.MdiParent = ActiveForm;
                PersonelGirisCikisFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void personelPozisyonlarıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["PersonelPoziyonlariFrm"] as Personel.PersonelPoziyonlariFrm;
            if (frm == null)
            {

                Form PersonelPoziyonlariFrm = new Personel.PersonelPoziyonlariFrm();
                PersonelPoziyonlariFrm.MdiParent = ActiveForm;
                PersonelPoziyonlariFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void personelSafaatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["PersonelSafaatFrm"] as Personel.PersonelSafaatFrm;
            if (frm == null)
            {

                Form PersonelSafaatFrm = new Personel.PersonelSafaatFrm();
                PersonelSafaatFrm.MdiParent = ActiveForm;
                PersonelSafaatFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void şubeTanıtımKartıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["Subelerfrm"] as Diger.Subelerfrm;
            if (frm == null)
            {

                Form Subelerfrm = new Diger.Subelerfrm();
                Subelerfrm.MdiParent = ActiveForm;
                Subelerfrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void ilTAToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["IlTanitimKarti"] as Diger.IlTanitimKarti;
            if (frm == null)
            {

                Form IlTanitimKarti = new Diger.IlTanitimKarti();
                IlTanitimKarti.MdiParent = ActiveForm;
                IlTanitimKarti.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void ilçeTanıtımKartıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["IlcelerFrm"] as Diger.IlcelerFrm;
            if (frm == null)
            {

                Form IlcelerFrm = new Diger.IlcelerFrm();
                IlcelerFrm.MdiParent = ActiveForm;
                IlcelerFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void kategoriTanıtımKartıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["IlcelerFrm"] as Diger.Kategorilerfrm;
            if (frm == null)
            {

                Form Kategorilerfrm = new Diger.Kategorilerfrm();
                Kategorilerfrm.MdiParent = ActiveForm;
                Kategorilerfrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void merkezÜrünlerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["UrunFrm"] as Depo.UrunFrm;
            if (frm == null)
            {

                Form UrunFrm = new Depo.UrunFrm();
                UrunFrm.MdiParent = ActiveForm;
                UrunFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void şubeÜrünlerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["SubeUrunFrm"] as Depo.SubeUrunFrm;
            if (frm == null)
            {

                Form SubeUrunFrm = new Depo.SubeUrunFrm();
                SubeUrunFrm.MdiParent = ActiveForm;
                SubeUrunFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void stokHareketleriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["UrunTransferFrm"] as Depo.UrunTransferFrm;
            if (frm == null)
            {

                Form UrunTransferFrm = new Depo.UrunTransferFrm();
                UrunTransferFrm.MdiParent = ActiveForm;
                UrunTransferFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        //private void hesapPlanıToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    Form frm = Application.OpenForms["HPLAN325"] as HPLAN325;
        //    if (frm == null)
        //    {

        //        Form HPLAN325 = new HPLAN325();
        //        HPLAN325.MdiParent = ActiveForm;
        //        HPLAN325.Show();
        //    }
        //    else
        //    {
        //        frm.Activate();
        //    }
        //}

        private void fişKayıtlarıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["MahsupFisiFrm"] as MahsupFisiFrm;
            if (frm == null)
            {

                Form MahsupFisiFrm = new MahsupFisiFrm();
                MahsupFisiFrm.MdiParent = ActiveForm;
                MahsupFisiFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void transferEvrakListesiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["TransferEvrakListesiFrm"] as Depo.TransferEvrakListesiFrm;
            if (frm == null)
            {

                Form TransferEvrakListesiFrm = new Depo.TransferEvrakListesiFrm();
                TransferEvrakListesiFrm.MdiParent = ActiveForm;
                TransferEvrakListesiFrm.Show();
            }
            else
            {
                frm.Activate();
            }
        }

        private void transferEvrakListesiDetaylıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = Application.OpenForms["TransferEvraklariRpr"] as Depo.Raporlar.TransferEvraklariRpr;
            if (frm == null)
            {

                Form TransferEvraklariRpr = new Depo.Raporlar.TransferEvraklariRpr();
                TransferEvraklariRpr.MdiParent = ActiveForm;
                TransferEvraklariRpr.Show();
            }
            else
            {
                frm.Activate();
            }
        }
        }
    }

